feat(k8s/tofu): add IAM agent-permissions OpenTofu module#193
Merged
Conversation
Port the permissions-role half of tofu-modules .../aws/iam/agent into the k8s scope as a reusable module, mirroring lambda/scope/tofu/iam/modules. Creates an IAM role holding the agent workload policies (Route53, EKS, ELB, AVP) whose trust policy allows only the agent IRSA role (agent_role_arn) to assume it via sts:AssumeRole. The IRSA agent role itself is provisioned at cluster setup and stays out of scope. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the verifiedpermissions:* policy and its role attachment from the agent permissions role. The role keeps only the Route53, EKS and ELB workload policies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fedemaleh
reviewed
Jun 26, 2026
fedemaleh
reviewed
Jun 26, 2026
fedemaleh
reviewed
Jun 26, 2026
fedemaleh
reviewed
Jun 26, 2026
update locals
Make agent_role_arn optional (defaults to the conventional nullplatform-<cluster>-agent-role) and add additional_agent_role_arns so extra roles can be appended to the trust policy alongside the primary one. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fedemaleh
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
Agrega el primer módulo de OpenTofu al scope de k8s, en
k8s/scope/tofu/iam/modules/, siguiendo la estructura del scope de lambda (lambda/scope/tofu/iam/modules/).El módulo crea únicamente el rol de permisos (con las policies workload: Route53, EKS, ELB, AVP) cuya trust policy permite que el rol IRSA del agente lo asuma vía
sts:AssumeRole. Es la mitadnullplatform_agent_permissionsdel módulotofu-modules/infrastructure/aws/iam/agent, portada verbatim. El rol IRSA del agente se sigue creando en el setup del cluster y queda fuera de alcance.Por qué
Separa la responsabilidad: el módulo
agentdetofu-modulesdeja de crear el rol de permisos (ver PR en ese repo) y pasa a ser provisionado por-cluster desde el scope de k8s. El wiring se mantiene por convención de nombre (nullplatform-{cluster}-agent-permissions-role), que la assume policy del agente ya autoriza.Archivos
k8s/scope/tofu/iam/modules/{data,locals,variables,main,outputs,versions}.tfVerificación
tofu fmt -check✓tofu validate✓ (Success)agent-asumme-rol): migración de state del rol + 4 policies desde el módulo agent al módulo nuevo →tofu planno-op, sin destruir ni recrear infra.Notas de despliegue
Coordinar con el refactor del módulo
agententofu-modules: el scope debe crear el rol de permisos con el nombre convencional antes/junto con elapplyque lo remueve del módulo agent.🤖 Generated with Claude Code